package com.zhangjun.socket.handler;

import com.zhang.view.chat.IChatMethod;
import com.zhangjun.application.UIService;
import com.zhangjun.chat.protocol.talk.TalkNoticeResponse;
import com.zhangjun.socket.MyBizHandler;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import javafx.application.Platform;

public class TalkNoticeHandler extends MyBizHandler<TalkNoticeResponse> {
    private UIService uiService;

    public TalkNoticeHandler(UIService uiService) {
        super(uiService);
    }

    @Override
    public void channelRead(Channel channel, TalkNoticeResponse msg) {
        IChatMethod chat = uiService.getChat();
        Platform.runLater(() -> {
            chat.addTalkBox(-1, 0, msg.getTalkId(), msg.getTalkName(), msg.getTalkHead(), msg.getTalkSketch(), msg.getTalkDate(), false);
        });
    }
}
